package jorm.boneCplugin;

import jorm.IDataSourceProvider;
import jorm.IPlugin;
import com.jolbox.bonecp.BoneCPConfig;
import com.jolbox.bonecp.BoneCPDataSource;

import javax.sql.DataSource;

/**
 * @auther:陈磊 <br/>
 * Date: 12-12-28<br/>
 * Time: 下午2:12<br/>
 * connectMethod:13638363871@163.com<br/>
 */
public class BoneCPDataSourePlugin implements IDataSourceProvider, IPlugin {

    private BoneCPDataSource dataSource;
    private BoneCPConfig config;
    public BoneCPDataSourePlugin(BoneCPConfig config){
      this.config=config;
    }

    @Override
    public boolean start() {
        return true;
    }

    public DataSource getDataSource() {
        dataSource=new BoneCPDataSource(this.config);
        return dataSource;
    }
    @Override
    public boolean stop() {
        dataSource.close();
        return true;  //To change body of implemented methods use File | Settings | File Templates.
    }

    /**
     * 注册modl
     *
     * @return
     */
    @Override
    public boolean register() {
        return false;
    }
}
